﻿<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>后台登录</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <!-- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> -->
    <link rel="stylesheet" href="__LINK__/static/css/font.css">
	<link rel="stylesheet" href="__LINK__/static/css/xadmin.css">

    <script type="text/javascript" src="__LINK__/static/js/jquery-3.1.1.js"></script>
    <script src="__LINK__/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__LINK__/static/js/xadmin.js"></script>
 

</head>
<body class="login-bg">
    
    <div class="login layui-anim layui-anim-up">
        <div class="message">后台登录</div>
        <div id="darkbannerwrap"></div>
        
        <form method="post" class="layui-form" >
            <input id="username" name="username" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input id="password" name="password" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
        </form>
        <button class="layui-btn" style="width:100%;" onclick="login()">登录</button>
        <hr class="hr20" >
    </div>

    <script>
        function login(){

		//验证
		var username = $('#username').val()
		var password = $('#password').val()
		// alert(username);
		
		if(username.length == 0){
			layer.msg('用户名不能为空',{
		    	time:600             //时间
		    	,offset: '300px'     //位置
		    });
		   
		    return false
		}
		if(password.length == 0){
			layer.msg('密码不能为空',{
		    	time:600             //时间
		    	,offset: '300px'     //位置
		    });
		   
		    return false
		}
		
		// 提交
		var url = "__APP__/admin/Admin/check";
		$.ajax({
		    type:"post",
		    url:url,
		    data:$(".layui-form").serialize(),  //序列化表单里面的所有参数
		    dataType:"json", //服务器返回类型
		    success:function(msg){
		    	// var msg=JSON.parse(res);
		
		        if(msg.status == false){
		            layer.msg(msg.msg,{
				    	time:500             //时间
				    	,offset: '300px'     //位置
				    })
		        }else{
		        	layer.msg(msg.msg,{
				    	time:500             //时间
				    	,offset: '300px'     //位置
				    	,end:function () {
					        window.location.href="{:url('admin/Index/index')}";
					     }                            //结束后的回调
				    })
		        	// window.location.href='__APP__/index/index';
		        	
		        }
		    }
		});
	}

        
    </script>

   
</body>
</html>